package com.example.base.ext

import java.lang.reflect.ParameterizedType
import java.lang.reflect.Type

/**
 * @Description
 * @department 城市元宇宙组
 * @Author niushilong
 * @Date 2024-04-07 11:33
 */

// 获取泛型的实例
fun<VM> getVMClass(clazz: Any, index: Int = 0): VM{
    return (clazz.javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[index] as VM
}